// ==UserScript==
// @name         sz91160放号后自选最后时间提交
// @namespace    http://www.91160.com/
// @version      2024-09-04
// @description  sz91160刷放号后自选最后时间提交,仅用于测试和学习研究，禁止用于商业用途!!!
// @author       goson
// @match        *://*.91160.com/guahao/ystep1/uid-*
// @icon         
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function GetDateStr(AddDayCount) {

        var dd = new Date();

        dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期

        var y = dd.getFullYear();

        var m = (dd.getMonth()+1)<10?"0"+(dd.getMonth()+1):(dd.getMonth()+1);//获取当前月份的日期，不足10补0

        var d = dd.getDate()<10?"0"+dd.getDate():dd.getDate();//获取当前几号，不足10补0

        return y+"-"+m+"-"+d;

    }
    var fast_cnt = 4;  // 快刷次数
    var loop_cnt = 4; //  停顿秒数

/*
ul id = delts
class=cur

checkbox id=check_yuyue_rule

button id=submitbtn
*/

https://www.91160.com/guahao/ystep1/uid-21


    var audio = new Audio('https://downsc.chinaz.net/Files/DownLoad/sound1/201709/9239.mp3');

    function checkData(data){
        var turl = 'https://www.91160.com/guahao/ystep1/uid-21/depid-4383/schid-';
        var synum = 0;
        var tnum = 0;
        var sid = '';
		var curl = window.location.href;
        if(curl.indexOf('guahao/ystep1/uid')>0){
			var ul = document.getElementById('delts');

			// 获取ul中的最后一个li元素
			var lastItem = ul.lastElementChild;
			if(lastItem){
                lastItem.setAttribute('class', 'cur');
                console.log('时间选择最后一个ok');
                document.getElementById('rst-lab').innerHTML = document.getElementById('rst-lab').innerHTML + '<br/>时间选择最后一个ok';
			}
			var cyr = document.getElementById('check_yuyue_rule');
			if(cyr){
				cyr.checked = 'checked'
                console.log('规则勾选ok');
                document.getElementById('rst-lab').innerHTML = document.getElementById('rst-lab').innerHTML + '<br/>规则勾选ok';
			}
			var sbtn = document.getElementById('submitbtn');
            console.log('提交按钮ok');
			//console.log(sbtn.innerHTML);
			//sbtn.click();
            document.getElementById('rst-lab').innerHTML = document.getElementById('rst-lab').innerHTML + '<br/>提交点击ok';
            //alert('提交成功');
        }
    }

    var v_unit_id
    if(typeof _unit_id === "undefined"){
        v_unit_id= 21;
    }else{
        v_unit_id= _unit_id;
    }

    var v_dep_id
    if(typeof _dep_id === "undefined"){
        v_dep_id= 4383;
    }else{
        v_dep_id= _dep_id;
    }


    function deleteDivById(id) {
        var div = document.getElementById(id);
        if (div) {
            div.parentNode.removeChild(div);
        }
    }

    function errStop(){
        clearInterval(lschId);
        clearTimeout(lschId);
        document.getElementById('actbtn').value = '已停止';
        document.getElementById('actbtn').innerText = '已停止';
        lschId = setTimeout(doGetAction,(document.getElementById('jiangeTime').value*2));
        document.getElementById('loop-cnt-lab').innerText =  '-暂被黑名单中暂停(秒)'+ (document.getElementById('jiangeTime').value*2)/1000;
    }

    	var lschId =0;
function createTopRightDiv() {
	deleteDivById('r-div');
    var div = document.createElement('div');
	div.id = 'r-div';
    div.style.position = 'fixed';
    div.style.top = '0';
    div.style.right = '0';
    div.style.zIndex = '9999';
    div.style.backgroundColor = 'white';
    div.style.padding = '10px';
    div.style.border = '1px solid #ddd';

    var label2 = document.createElement('label');
	label2.id = 'rst-lab'
	label2.textContent = '';
    label2.style.marginBottom = '10px';
        label2.style.borderColor = 'red';  // 边框颜色
        label2.style.backgroundColor  = '#87ff2a';  // 背景颜色

    div.appendChild(label2);
    // 将div添加到body
    document.body.appendChild(div);
}
createTopRightDiv();


	checkData('');
})();